/*
 * --------------------------------------------------------------
 * Copyright ©  2015 Hangzhou DtDream Technologies Co.,Ltd.
 * --------------------------------------------------------------
 *      Product: 协同数治
 *  Module Name: design
 * Date Created: 2022/12/14
 *  Description: TODO
 * --------------------------------------------------------------
 * Modification History
 * DATE            NAME            Description
 * --------------------------------------------------------------
 * 2022/12/14       yewj            TODO
 * --------------------------------------------------------------
 */

package com.dtdream.principle.segregation;

/**
 * 接口隔离原则
 *
 * @Author: yewj
 **/
public class SegregationOne {
    public static void main(String[] args) {
        A a = new A();
        a.dependOne(new B());
        a.dependOne(new D());
    }
}

interface InterfaceOne {
    void operationOne();
    void operationTwo();
    void operationThree();
    void operationFour();
    void operationFive();
}

class B implements InterfaceOne {

    @Override
    public void operationOne() {
        System.out.println("B中实现了operationOne");
    }

    @Override
    public void operationTwo() {
        System.out.println("B中实现了operationTwo");
    }

    @Override
    public void operationThree() {
        System.out.println("B中实现了operationThree");
    }

    @Override
    public void operationFour() {
        System.out.println("B中实现了operationFour");
    }

    @Override
    public void operationFive() {
        System.out.println("B中实现了operationFive");
    }
}


class D implements InterfaceOne {

    @Override
    public void operationOne() {
        System.out.println("D中实现了operationOne");
    }

    @Override
    public void operationTwo() {
        System.out.println("D中实现了operationTwo");
    }

    @Override
    public void operationThree() {
        System.out.println("D中实现了operationThree");
    }

    @Override
    public void operationFour() {
        System.out.println("D中实现了operationFour");
    }

    @Override
    public void operationFive() {
        System.out.println("D中实现了operationFive");
    }
}

class A {
    public void dependOne(InterfaceOne interfaceOne) {
        interfaceOne.operationOne();
    }

    public void dependTwo(InterfaceOne interfaceOne) {
        interfaceOne.operationTwo();
    }

    public void dependThree(InterfaceOne interfaceOne) {
        interfaceOne.operationThree();
    }
}

class C {
    public void dependOne(InterfaceOne interfaceOne) {
        interfaceOne.operationOne();
    }

    public void dependFour(InterfaceOne interfaceOne) {
        interfaceOne.operationFour();
    }

    public void dependFive(InterfaceOne interfaceOne) {
        interfaceOne.operationFive();
    }
}
